package com.jzo2o.customer.controller.operation;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jzo2o.common.model.PageResult;
import com.jzo2o.customer.constants.CertificationConstants;
import com.jzo2o.customer.model.domain.WorkerCertificationAudit;
import com.jzo2o.customer.model.dto.request.WorkerCertificationAuditPageQueryReqDTO;
import com.jzo2o.customer.model.dto.response.RejectReasonResDTO;
import com.jzo2o.customer.model.dto.response.WorkerCertificationAuditResDTO;
import com.jzo2o.customer.service.IWorkerCertificationAuditService;
import com.jzo2o.mysql.utils.PageUtils;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author: liZhiJun
 * @CreateTime: 2025-09-26
 * @Description: 服务人员认证审核
 * @Version: 1.0
 */

@RestController("operationWorkerCertificationAuditController")
@RequestMapping("/operation/worker-certification-audit")
public class WorkerCertificationAuditController {
    @Resource
    private IWorkerCertificationAuditService workerCertificationAuditService;

    @GetMapping("/page")
    @ApiOperation("分页查询认证审核")
    public PageResult<WorkerCertificationAuditResDTO> page(WorkerCertificationAuditPageQueryReqDTO pageQueryReqDTO) {
        Page<WorkerCertificationAudit> page = workerCertificationAuditService.pageAudit(pageQueryReqDTO);
        return PageUtils.toPage(page, WorkerCertificationAuditResDTO.class);
    }



    @PutMapping("/audit/{id}")
    @ApiOperation("服务人员审核认证")
    public void audit(@PathVariable Long id,@RequestParam("certificationStatus") Integer certificationStatus, @RequestParam("rejectReason")  String rejectReason) {
       workerCertificationAuditService.audit(id,certificationStatus,rejectReason);
    }

}
